<?php
class AdminModel extends Model{
	protected $_validate=array(
		array('username','require','用户名必填!'),
		array('password','require','密码必填!'),
	
	
	
	);
	
	
	public function islogin(){
		return $_SESSION['YunPHPAdmin'] == '1';
	}
	
	/**
    +----------------------------------------------------------
    * 登录检测
    +----------------------------------------------------------
    */
	public function checkLogin($username,$password){
		$result = $this->where(array('username'=>$username,'password'=>md5($password)))->find();
		if (is_array($result)){
			$_SESSION['YunPHPAdmin'] = '1';
			$_SESSION['YunPHPName'] = $result['username'];
			return true;
		}else{
			return false;
		}
	}
	
}
?>